<?php

class newsBlockWidgetComponents extends myComponents{

    public function executeRender(){
        // newsblock widget
  	$q = Doctrine::getTable('NewItem')->createQuery('n')
  		->select('n.*')
  		->from('NewItem n')
  		->innerJoin('n.NewsGroup bg')
  		->innerJoin('bg.StructureNewsGroup sbg')
  		->innerJoin('sbg.Structure s WITH s.id = ?', $this->getRoute()->getObject()->getId())
  		->orderBy('n.pri asc')
		->addOrderBy('n.id desc')
  		->limit(3);

        $this->news = $q->execute();

    }

}